<?php

namespace App\Models\Payment;

use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;

/**
 * App\Models\Payment\Payment
 *
 * @property int         $id
 * @property string      $mchid       商户id
 * @property string      $secret_key  v3 秘钥
 * @property string      $secret_key2 v2 秘钥
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @method static Builder|Payment newModelQuery()
 * @method static Builder|Payment newQuery()
 * @method static Builder|Payment query()
 * @method static Builder|Payment whereCreatedAt($value)
 * @method static Builder|Payment whereId($value)
 * @method static Builder|Payment whereMchid($value)
 * @method static Builder|Payment whereSecretKey($value)
 * @method static Builder|Payment whereSecretKey2($value)
 * @method static Builder|Payment whereUpdatedAt($value)
 * @mixin Eloquent
 */
class Payment extends Model
{
    use HasFactory;

    protected $table = "payments";
    protected $fillable
                     = [
            "mchid",
            "secret_key",
            "secret_key2",
        ];

    public function getSecretKeyV3()
    {
        return $this->getAttribute('secret_key');
    }

    public function getMchId()
    {
        return $this->getAttribute('mchid');
    }

    public function getSecretKeyV2()
    {
        return $this->getAttribute('secret_key2');
    }

}
